package cn.edu.scau.cmi.heyonglin.client;

import java.util.Scanner;

import cn.edu.scau.cmi.heyonglin.abstractFactory.AbstractFactory;
import cn.edu.scau.cmi.heyonglin.abstractFactory.AonongFactory;
import cn.edu.scau.cmi.heyonglin.abstractFactory.ConsumerMeat;
import cn.edu.scau.cmi.heyonglin.abstractFactory.TianbangFactory;
import cn.edu.scau.cmi.heyonglin.abstractFactory.WensFactory;

public class AbstractFactoryClient {

	public static void main(String[] args) {
		boolean b=true;
		System.out.println("Please select which brand you want to buy: Wens, Aonong or Tianbang:");
		Scanner scanner = new Scanner(System.in);  
		String brandKind = scanner.next();  
		AbstractFactory factory=null;
		switch(brandKind){
		case "Wens": factory=new WensFactory();break;
		case "Tianbang": factory=new TianbangFactory();break;
		case "Aonong": factory=new AonongFactory();break;
		default:System.out.println("sorry, your input is not correct");b=false;
		
		}
		if(b==true) {
		   System.out.println("Please select which meat you want to buy: porke, beef or chicken:"); 
		   String productType = scanner.next();  
		   ConsumerMeat meat=null;
		   switch(productType) {
		   case "pork": meat=factory.createPork();break;
		   case "chicken": meat=factory.createChicken();break;
		   case "beef": meat=factory.createBeef();break;
		   default:System.out.println("sorry, your input is not correct");
		   }
		   if(meat!=null) {
			   meat.play();
		   }
		}

	}

}
